<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Edit Profile</title>
    </h:head>
    <h:body>
        <h:form id="editProf" > 
            <hr></hr>
            <h:messages/>
            <fieldset><h:outputLabel for="editName" value="Name:"/>
                <h:inputText value="#{loginBean.checkedUser.name}" id="editName" required="true"/>
                <h:message for="editName"/>
                <br/>
                <h:outputLabel for="editSurname" value="Surname(*):"/>
                <h:inputText value="#{loginBean.checkedUser.surname}" id="editSurname" required="true"/>
                <h:message for="editSurname"/>
                <br/>
                <h:outputLabel for="editUsername" value="Username(*):"/>
                <h:inputText id="editUsername" value="#{loginBean.checkedUser.username}" required="true" readonly="true"/>
                <h:message for="editUsername"/>
                <br/>
                <h:outputLabel for="editPassword" value="Password(*):"/>
                <h:inputSecret id="editPassword" value="#{loginBean.checkedUser.password}" required="true"/>
                <h:message for="editPassword"/>
                <br/>
                <h:outputLabel for="editEmail" value="Email(*):"/>
                <h:inputText id="editEmail" value="#{loginBean.checkedUser.email}" required="true" readonly="true"/>
                <h:message for="editEmail"/>
                <br/>
                <h:selectOneRadio id="sor" value="#{loginBean.checkedUser.userType}" required="true" 
                                  title="Please choose a user type" layout="pageDirection" border="1">
                    <f:selectItem id="ut1"   itemLabel="Student" itemValue="student" />
                    <f:selectItem id="ut22"  itemLabel="lecturer" itemValue="lecturer" />
                    <f:selectItem id="ut3"   itemLabel="Other academic staff" itemValue="other academic staff" />
                </h:selectOneRadio>
                <br/>              
                <h:outputLabel for="editStreetName" value="Street Name(*):"/>
                <h:inputText id="editStreetName" value="#{loginBean.checkedUser.streetName}" required="true"/>
                <h:message for="editStreetName"/>
                <br/>
                <h:outputLabel for="editZip" value="Zip(*):"/>
                <h:inputText id="editZip" value="#{loginBean.checkedUser.zip}" required="true"/>
                <h:message for="editZip"/>
                <br/>
                <h:outputLabel for="editWebsite" value="Website:"/>
                <h:inputText id="editWebsite" value="#{loginBean.checkedUser.website}"/>
                <h:message for="editWebsite"/>
            </fieldset>  
            <hr></hr>
            <h:commandButton value="Update" action="#{editProfileBean.persistEditedProfile()}"/>
            <h:commandButton value="Cancel"  immediate="true" action="showIndex"></h:commandButton>
            <hr></hr>
        </h:form>
    </h:body>
</html>
